<?php

class Jf_View_Helper_SwfUpload extends Jf_View_Helper_Abstract {

    public function swfUpload () {
        $timestamp = time ();
        $init = 'var swfu = \'\';
		$(document).ready(function(){
		swfu = new SWFUpload({
			flash_url:"/statics/admin/js/plugins/swfupload/swfupload.swf?"+Math.random(),
			upload_url:"/api/image/upload",
			file_post_name : "Filedata",
			post_params:{
                "timestamp" : "' . $timestamp . '",
				"token": "' . md5 ($timestamp . 'unique_salt') . '",
				' . session_name () . ': "' . session_id () . '"
			},
			file_size_limit: "5 MB",
			file_types:"*.jpg;*.jpge;*.png;*.gif",
			file_types_description:"All Files",
			file_upload_limit:"10",
			custom_settings : {progressTarget : "fsUploadProgress",cancelButtonId : "btnCancel"},
	 
			button_image_url: "",
			button_width: 75,
			button_height: 28,
			button_placeholder_id: "buttonPlaceHolder",
			button_text_style: "",
			button_text_top_padding: 3,
			button_text_left_padding: 12,
			button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
			button_cursor: SWFUpload.CURSOR.HAND,

			file_dialog_start_handler : fileDialogStart,
			file_queued_handler : fileQueued,
			file_queue_error_handler:fileQueueError,
			file_dialog_complete_handler:fileDialogComplete,
			upload_progress_handler:uploadProgress,
			upload_error_handler:uploadError,
			upload_success_handler:uploadSuccess,
			upload_complete_handler:uploadComplete
			});
		});';
        return $init;
    }

}
?>
